<template>
	<el-dialog append-to-body :visible.sync="visible" title="PID参数历史数据" :close-on-click-modal="false" width="800px" :close-on-press-escape="false">
		<div>
			<el-table v-loading="dataListLoading" :data="dataList" border
				@selection-change="dataListSelectionChangeHandle" @sort-change="dataListSortChangeHandle"
				style="width: 100%;">
				<el-table-column type="index" label="序号" header-align="center" align="center" width="50">
				</el-table-column>
				<el-table-column prop="name" label="PID参数保存名称" header-align="center" align="center"></el-table-column>
				<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="300">
					<template slot-scope="scope">
						<el-button v-if="$hasPermission('sys:role:update')" type="success" round size="mini"
							@click="addOrUpdateHandle(scope.row.id)">加载</el-button>
						<el-button v-if="$hasPermission('sys:role:delete')" type="danger" round size="mini"
							@click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
					</template>
				</el-table-column>
			</el-table>
			<el-pagination background :current-page="page" :page-sizes="[10, 20, 50, 100]" :page-size="limit" :total="total"
				layout="total, sizes, prev, pager, next, jumper" @size-change="pageSizeChangeHandle"
				@current-change="pageCurrentChangeHandle">
			</el-pagination>
		</div>
	</el-dialog>
</template>

<script>
	import mixinViewModule from '@/mixins/view-module'
	export default {
		mixins: [mixinViewModule],
		data(){
			return{
				mixinViewModuleOptions: {
					getDataListURL: '/psc/dcupidparameters/page',
					getDataListIsPage: true,
					deleteURL: '/psc/dcupidparameters',
					deleteIsBatch: true
				},
				visible:false,
			}
		},
		methods:{
			init(){
				this.visible = true
				this.dataListLoading = true
				this.$nextTick(()=>{
					this.$http.get('/psc/dcupidparameters/page').then(res=>{
						if(res.data.code==0){
							this.dataList = res.data.data.list
							this.total = res.data.data.total
							this.dataListLoading = false
						}
					})
				})
			},
			//查看数据
			addOrUpdateHandle(id){
				this.visible = false
				this.$emit('getHistory',id)
			}
		}
	}
</script>

<style>
</style>